<template>
	<view class="menuBox">
		<view class="menuItem" @click="goto('/pages/index/index')">
			<image :src="curRoute=='pages/index/index'?'/static/menu/推文.png':'/static/menu/un推文.png'" alt=""
				mode="widthFix" />
			<text>推文</text>
		</view>
		<view class="menuItem" @click="goto('/pages/index/me/me')">
			<image :src="curRoute=='pages/index/index'?'/static/menu/un我的.png':'/static/menu/我的.png'" alt=""
				mode="widthFix" />
			<text>我的</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				curRoute: '', //当前路由
			}
		},
		methods: {
			goto(url) {
				uni.redirectTo({
					url: url
				})
			}
		},
		onLoad() {},
		mounted() {
			let routes = getCurrentPages(); // 获取当前打开过的页面路由数组
			this.curRoute = routes[routes.length - 1].route // 获取当前页面路由，也就是最后一个打开的页面路由
		}
	}
</script>

<style scoped>
	.menuItem text {
		display: block;
		font-size: 10px;
		line-height: 14.48px;
		color: rgba(255, 255, 255, 1);
		line-height: 10px;
	}

	.menuItem image {
		margin-top: 8px;
		width: 28px;
		height: 28px;
	}

	.menuItem {
		flex: 1;
		justify-content: space-around;
		text-align: center;
	}

	.menuBox {
		width: 100%;
		height: 70px;
		position: fixed;
		bottom: 0;
		background-color: rgba(45, 45, 45, 1);
		display: flex;
	}
</style>